home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / encryp1a / encrypto.cls < prev    next >
Encoding:
Visual Basic class definition  |  1999-09-05  |  1.2 KB  |  52 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "Encryptor"
  6. Attribute VB_GlobalNameSpace = False
  7. Attribute VB_Creatable = True
  8. Attribute VB_PredeclaredId = False
  9. Attribute VB_Exposed = True
  10. Private Result As String
  11. Private Code As Integer
  12. Private AssRes As String
  13. Public Sub About()
  14. Dim MSG As String
  15. MSG = "Encryptor ActiveX DLL" & Chr$(13)
  16. MSG = MSG & "Version " & App.Major & "-" & App.Minor & "-" & App.Revision & Chr$(13)
  17. MSG = MSG & "Written by Jack Hoxley" & Chr$(13)
  18. MSG = MSG & "EMail: Jollyjeffers@hotmail.com"
  19. MsgBox MSG
  20. End Sub
  21.  
  22. Public Function Encrypt(StrEnc As String, IntVal As Integer) As String
  23. If inval > 128 Then IntVal = 128
  24. AssRes = ""
  25. For i = 1 To Len(StrEnc)
  26. Result = Mid$(StrEnc, i, 1)
  27. Code = Asc(Result)
  28. Code = Code + Int(IntVal)
  29. If Code > 255 Then
  30. Code = Code - 255
  31. End If
  32. AssRes = AssRes & Chr$(Code)
  33. Next i
  34. Encrypt = AssRes
  35. End Function
  36.  
  37.  
  38. Public Function Decrypt(StrEnc As String, IntVal As Integer) As String
  39. If inval > 128 Then IntVal = 128
  40. AssRes = ""
  41. For i = 1 To Len(StrEnc)
  42. Result = Mid$(StrEnc, i, 1)
  43. Code = Asc(Result)
  44. Code = Code - Int(IntVal)
  45. If Code > 255 Then
  46. Code = Code - 255
  47. End If
  48. AssRes = AssRes & Chr$(Code)
  49. Next i
  50. Decrypt = AssRes
  51. End Function
  52.